package org.component.item 
{
	import flash.display.MovieClip;
	import org.component.interfaces.IListItem;
	import org.component.interfaces.IListItemData;
	import org.component.List;
	import com.peachcastle.core.Display;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ListItem extends Display implements IListItem
	{
		
		//主体;
		protected var _subject:List = null;
		
		private var _data:IListItemData = null;
		
		
		public function ListItem(ui:MovieClip =null) 
		{
			super(ui);
		}
		
		public function getSubject(list:List = null):void
		{
			_subject = list;
		}
		
		public function update(data:IListItemData = null):void
		{
			super.showAssest();
			
			_data = data;
			
			select = (_subject && _subject.selectIndex == index);
			
		}
		
		public function dispose():void
		{
			super.hideAssest();
		}
		
		private var _index:int = -1;
		
		public function get index():int { return _index; }
		public function set index(value:int):void { _index = value; }
		
		
		private var _select:Boolean = false;
		public function get select():Boolean { return _select;}
		public function set select(value:Boolean):void
		{
			_select = value;
		}
		
		public function get listdata():IListItemData { return _data; }
		
	}

}